<style>
	table th, table td{
		text-align: center !important;
	}
	.page-content .portlet .portlet-search-body .search-item{
		width: 15%;
	}
	.twitter-typeahead{
		top: 2px;
	}
</style>

<div class="portlet">
    <div class="portlet-actions">
        <button class="btn blue btn-sm rounded" ng-click="grid.add()"><i class="fa fa-plus"></i> 新增</button>
    </div>
    <form class="portlet-search-body" name="queryForm">
        <input type="text" class="form-control search-item" ng-model="stockName" placeholder="材料名称">
		<div class="col-md-2">
			<div ed-combotree data-options="idField: 'typeId', textField: 'typeName', parentIdField: 'parentTypeId', url:'stockType/tree.do'"
				 ng-model="typeId" placeholder="材料类型"></div>
		</div>
		<div class="input-group input-large date-picker input-daterange" ed-date-picker style="float: left;margin-right: 10px;">
			<input type="text" class="form-control" ng-model="makeTimeStart" placeholder="操作时间(开始)">
			<span class="input-group-addon">- </span>
			<input type="text" class="form-control" ng-model="makeTimeEnd" placeholder="操作时间(截止)">
		</div>

        <div class="search-item">
            <button class="btn btn-icon-only default"><i class="fa fa-chevron-right"></i></button>
            <button class="btn btn-sm query rounded" ng-click="query();"><i class="fa fa-search"></i> 查询</button>
            <button class="btn btn-sm reset rounded" ng-click="reset();"><i class="fa fa-eraser"></i> 重置</button>
        </div>
    </form>
    <div class="portlet-body">
        <table ed-grid="grid"  class="table table-striped table-bordered table-advance table-hover"
               data-options="url: 'stockTransferOut/query.do?type={{transferType}}', modelText: 'xx列表', form: 'queryForm', modal: 'modal'">
			<thead>
			<tr>
				<th data-options="field: '_index'"></th>
				<th style="color: #e80b26;" data-options="field: 'stockName'">材料名称</th>
				<th style="color: #e80b26;" data-options="field: 'typeName'">类型</th>
				<th style="color: #e80b26;" data-options="field: 'spec'">规格</th>
				<th style="color: #e80b26;" data-options="field: 'brand | code : stockBrand'">品牌</th>
				<th style="color: #e80b26;" data-options="field: 'unit'">单位</th>
				<th data-options="field: 'num'">数量</th>
				<th data-options="field: 'price | currency: ¥'">单价</th>
				<th data-options="field: 'totalPrice | currency: ¥'">总价</th>
				<th data-options="field: 'makeTime | limitTo : 10'">操作时间</th>
				<th data-options="field: 'location'">使用地点</th>
				<th data-options="field: 'purpose'">用途</th>
				<th data-options="field: 'content'">制作内容</th>
				<th data-options="field: 'userName'">领用人</th>
				<th>操作</th>
			</tr>
			</thead>
        </table>
    </div>
</div>

<div ed-modal="modal" data-options="title: 'xxxx', static: true, width: 720, defaultButton:false,onHidden:'reset'">
    <form action="#" class="form-horizontal w5c-form" w5c-form-validate novalidate name="validateForm">
        <div class="form-body">
			<div class="rounded" style="border:1px solid #ececec; padding: 10px 10px 0px 10px;">
				<div class="form-group">
					<label class="col-md-2 control-label"><span style="color:red">* </span>材料名称</label>
					<div class="col-md-4">
						<div class="input-group">
							<input type="text" class="form-control" name="spec" ng-model="stockTransferOut.stockName" disabled ng-hide="type==1">
							<div stock-search stock-ret="stockRet()" ng-model="stockTransferOut.stockName" name="stockName" ng-show="type==1"></div>
							<span class="input-group-btn">
								<button class="btn btn-default blue" style="height: 32px;" type="button" ng-click="modalStock.setTitle('库存列表').show();" ng-disabled="type!=1">仓库</button>
							</span>
						</div>
					</div>
					<label class="col-md-2 control-label"><span style="color:red">* </span>类型</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="spec" ng-model="stockTransferOut.typeName" disabled>
						<!--<div ed-combotree data-options="idField: 'typeId', textField: 'typeName', parentIdField: 'parentTypeId', url:'stockType/tree.do'"
							 ng-model="stockTransferOut.typeId" ng-show="type==1"></div>-->
					</div>
				</div>

				<div class="form-group">
					<label class="col-md-2 control-label"><span style="color:red">* </span>规格</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="spec" ng-model="stockTransferOut.spec" ng-disabled="true" required>
					</div>
					<label class="col-md-2 control-label"><span style="color:red">* </span>品牌</label>
					<div class="col-md-4">
						<select class="form-control" name="brand" ng-model="stockTransferOut.brand"
								ng-options="opt.value as opt.name for opt in options.stockBrand" ng-disabled="true" required>
						</select>
					</div>
				</div>

				<div class="form-group">
					<label class="col-md-2 control-label"><span style="color:red">* </span>单位</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="unit" ng-model="stockTransferOut.unit" ng-disabled="true" required>
					</div>
				</div>
			</div>

			<div class="rounded" style="border:1px solid #ececec; padding: 10px 10px 0px 10px;margin-top: 10px;">
				<div class="form-group">
					<label class="col-md-2 control-label"><span style="color:red">* </span>数量</label>
					<div class="col-md-4">
						<input type="number" class="form-control" name="num" ng-model="stockTransferOut.num" pattern="^(0|[1-9][0-9]*)$" ng-disabled="type==3" required>
					</div>
					<label class="col-md-2 control-label"><span style="color:red">* </span>单价</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="price" ng-model="stockTransferOut.price" pattern="^[1-9]\d*(.\d{1,2})?$" ng-disabled="type==3" required>
					</div>
				</div>

				<div class="form-group">
					<label class="col-md-2 control-label"><span style="color:red">* </span>总价</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="totalPrice" ng-model="stockTransferOut.totalPrice" pattern="^[1-9]\d*(.\d{1,2})?$" ng-disabled="true" required>
					</div>
					<label class="col-md-2 control-label"><span style="color:red">* </span>操作时间</label>
					<div class="col-md-4">
						<div class="input-group">
							<input type="text" class="form-control" ed-date-picker name="makeTime" ng-model="stockTransferOut.makeTime" ng-disabled="type==3" required>
							<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
						</div>
					</div>
				</div>

				<div class="form-group">
					<label class="col-md-2 control-label">使用地点</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="location" ng-model="stockTransferOut.location" ng-disabled="type==3">
					</div>
					<label class="col-md-2 control-label"><span style="color:red">* </span>领用人</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="userName" ng-model="stockTransferOut.userName" ng-show="type==3" ng-disabled="type==3">
						<div emp-select name="userId" ng-model="stockTransferOut.userId" ng-show="type!=3" required></div>
					</div>
				</div>

				<div class="form-group">
					<label class="col-md-2 control-label">用途</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="purpose" ng-model="stockTransferOut.purpose" ng-disabled="type==3">
					</div>
					<label class="col-md-2 control-label">制作内容</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="content" ng-model="stockTransferOut.content" ng-disabled="type==3">
					</div>
				</div>

				<div class="form-group">
					<label class="col-md-2 control-label">备注</label>
					<div class="col-md-4">
						<input type="text" class="form-control" name="remark" ng-model="stockTransferOut.remark" ng-disabled="type==3">
					</div>
				</div>
			</div>
        </div>
        <div class="form-actions">
            <button type="button" class="btn default" ng-click="grid.cancel();">
                <i class="fa fa-times"></i> 取消
            </button>
            <button type="button" class="btn blue" w5c-form-submit="grid.save();">
                <i class="fa fa-check"></i> 确定
            </button>
        </div>
    </form>
</div>


<!--选择库存材料-->
<div ed-modal="modalStock" data-options="title: 'xxxx', static: true, width: 720, defaultButton:false,onHidden:'reset'">
	<div class="portlet">
		<form class="portlet-search-body" name="queryFormStock" style="display: -webkit-box;">

			<input type="text" class="form-control search-item" ng-model="stockName" placeholder="材料名称" style="width: 200px">
			<input type="text" class="form-control search-item" ng-model="typeName" placeholder="类型" style="width: 200px; margin-left: 10px;">

			<div class="search-item">
				<button class="btn btn-sm query rounded" ng-click="query();" style="margin-top: 2px; margin-left: 10px"><i class="fa fa-search"></i> 查询</button>
				<button class="btn btn-sm reset rounded" ng-click="reset();" style="margin-top: 2px;"><i class="fa fa-eraser"></i> 重置</button>
			</div>
		</form>
		<div class="portlet-body">
			<table ed-grid="gridStock" style="width: 100%" class="table table-striped table-bordered table-advance table-hover"
				   data-options="url: 'stock/query.do', modelText: '库存材料', form: 'queryFormStock'">
				<thead>
				<tr>
					<th style="width: 4%">操作</th>
					<th style="width: 24%" data-options="field: 'stockName'">材料名称</th>
					<th style="width: 24%" data-options="field: 'typeName'">类型</th>
					<th style="width: 24%" data-options="field: 'brand'">品牌</th>
					<th style="width: 24%" data-options="field: 'spec'">规格</th>
				</tr>
				</thead>
			</table>
		</div>
	</div>
</div>